feat(collections): option to merge undefined in deepMerge#6522
feat(collections): option to merge undefined in deepMerge#6522WWRS wants to merge 2 commits intodenoland:mainfrom
undefined in deepMerge#6522Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6522 +/- ##
=======================================
Coverage 95.21% 95.22%
=======================================
Files 577 577
Lines 43381 43385 +4
Branches 6487 6489 +2
=======================================
+ Hits 41307 41312 +5
+ Misses 2034 2033 -1
Partials 40 40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
collections/deep_merge.ts
Outdated
| * | ||
| * @default {"replace"} | ||
| */ | ||
| undefined?: "replace" | "ignore"; |
There was a problem hiding this comment.
strange that the key is a keyword undefined
There was a problem hiding this comment.
That's true. Maybe undefineds would be better?
| * | ||
| * @default {"replace"} | ||
| */ | ||
| undefineds?: "replace" | "ignore"; |
There was a problem hiding this comment.
Just above, the options are named arrays, sets, and maps, so I think undefineds does match with those most closely
There was a problem hiding this comment.
I see the point, but the usage of the word undefineds seems very rare compared to sets, maps, arrays. I'm afraid this might be confusing to the users. (I personally prefer the original undefined over undefineds. undefined is not JavaScript keyword (ref), but just predefined variable name. I personally disagree with @ry's concern..)
resolves #4752
Default is
"replace", which is the existing behavior.